import request from '@/utils/request'
// 获取一级分类数据
export function getCategory1List() {
  return request({
    url: '/admin/product/getCategory1',
    method: 'get'
  })
}
// 获取二级分类数据
export function getCategory2List(category1Id) {
  return request({
    url: `/admin/product/getCategory2/${category1Id}`,
    method: 'get'
  })
}
// 获取三级分类数据
export function getCategory3List(category2Id) {
  return request({
    url: `/admin/product/getCategory3/${category2Id}`,
    method: 'get'
  })
}
// 根据三级分类获取属性接口
export function getAttrByCategoryId({ category1Id, category2Id, category3Id }) {
  return request({
    url: `/admin/product/attrInfoList/${category1Id}/${category2Id}/${category3Id}`,
    method: 'get'
  })
}
// 新增/编辑属性
export function addOrUpdateAttr(data) {
  return request({
    url: '/admin/product/saveAttrInfo',
    method: 'post',
    data
  })
}
// 得到某一个商品的属性
export function getAttrByAttrId(attrId) {
  return request({
    url: `/admin/product/getAttrValueList/${attrId}`,
    method: 'get'
  })
}
// 删除某个商品的属性
export function deleteAttrById(attrId) {
  return request({
    url: `/admin/product/deleteAttr/${attrId}`,
    method: 'delete'
  })
}
